var $ = require('../../../utils/helper.js'), that = null
var app = getApp()
Page({
  data: {
    name:1

  },
  onLoad(e) {
    that = this
   
  },
  onShow: function () {
    $.check(that)
  },
  onReady: function () {

  },
  init: function () {
    that.headerimg()
    that.statistics()
    that.newservice()
    that.newsignup()
    that.homeservicelist()
    that.signuppush()
    that.serverpush()
    that.article_push()
    that.homesignpulist()
  },
  headerimg:function(){
    $.post("api/index/advert",{type:0},function(advert){
        that.setData({advert:advert})
    })
  },
  statistics:function(){
    $.post("api/index/visit",null,function(data){
      that.setData({ visit:data})
    })
  },
  chengename:function(e){
    let name = e.currentTarget.dataset.name
    that.setData({name:name})
  },
  newservice:function(){
    $.post("api/service/new_lists",null,function(lists){
      that.setData({newservice_list:lists})
     
    })
  },
  newsignup:function(){
    $.post("api/signup/new_lists",null,function(lists){
      that.setData({ newsignup_list: lists })
    })
  },
  homeservicelist:function(){
    $.post("api/index/home_servicelist",null,function(lists){
      that.setData({ home_servicelist:lists})
    })
  },
  homesignpulist: function () {
    $.post("api/index/home_signpulist", null, function (lists) {
      that.setData({ home_signpulist: lists })
    })
  },
  signuppush:function(){
    $.post("api/signup/push", null, function (lists){
      that.setData({signuppush_list:lists})
    })
  },
  serverpush:function(){
    $.post("api/service/push",null,function(lists){
      that.setData({serverpush_list:lists})
    })
  
  },
  article_push:function(){
    $.post("api/news/push",null,function(data){
      that.setData({ news_push:data})
    })
  },
  toservicelist:function(e){
    let id = e.currentTarget.dataset.id
    wx.setStorageSync("service_cate_id", id)
    wx.switchTab({
      url: '/pages/service/index/index',
    })
  
  },
   tosignuplist: function (e) {
    let id = e.currentTarget.dataset.id
    wx.setStorageSync("signup_cate_id", id)
    wx.switchTab({
      url: '/pages/signup/index/index',
    })

  }
}) 